All Questions
Tagged with programming-challengeecmascript-6
65 questions
4votes
1answer
1kviews
Leetcode three sum in Javascript
I was doing 3sum question on leetcode Question Given an array nums of n integers, are there elements a, b, c in nums such that a + b + c = 0? Find all unique triplets in the array which gives the sum ...
5votes
2answers
520views
Frequency Queries (Hackerrank)
This is the problem: You are given queries. Each query is of the form two integers described below: 1 x: Insert x in your data structure. 2 y: Delete one occurrence of y from your data ...
5votes
2answers
2kviews
Process strings of operations
This was the task (I don't know the exact wordings anymore): You get a string with operation as input: if it is a number push it to stack if it is "DUP", then duplicate the one one top and ...
8votes
5answers
1kviews
Expanding powers of expressions of the form ax+b
I solved the following problem: Write a function expand that takes in an expression with a single, one character variable, and expands it. The expression is in the form ...
3votes
1answer
1kviews
Shortest way to form a string out of a subsequence of a string
The task is taken from LeetCode (subscription required) - From any string, we can form a subsequence of that string by deleting some number of characters (possibly no deletions). Given two strings ...
6votes
4answers
3kviews
Find all letter Combinations of a Phone Number
The task is taken from LeetCode Given a string containing digits from 2-9 inclusive, return all possible letter combinations that the number could represent. A mapping of digit to letters (just ...
2votes
1answer
757views
Given time intervals determine if a person could attend all meetings
The task is taken from LeetCode Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] ...
5votes
1answer
8kviews
Merge Two Sorted Lists in JavaScript
The task is taken from LeetCode Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. Example 1: ...
8votes
1answer
2kviews
Merge Intervals in JavaScript
This is a task taken from Leetcode - Given a collection of intervals, merge all overlapping intervals. Example 1: ...
1vote
3answers
545views
Jewels and Stones
The task is taken from leetcode You're given strings J representing the types of stones that are jewels, and S representing the stones you have. Each character in S is a type of stone you have....
5votes
1answer
323views
Find the starting indices of all occurrences of the pattern in the string - KMP algorithm follow-up
The task was initially solved here, but was too buggy: Given a string and a pattern, find the starting indices of all occurrences of the pattern in the string. For example, given the string "...
2votes
1answer
266views
Number of Islands
The task is taken from leetcode Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacent lands ...
2votes
1answer
477views
Length of the longest consecutive run of 1s in its binary representation
The task Given an integer n, return the length of the longest consecutive run of 1s in its binary representation. For example, given 156, you should return 3 My function solution 1 Style 1 <...
3votes
1answer
633views
Longest Consecutive Sequence
This task is taken from Leetcode - Given an unsorted array of integers, find the length of the longest consecutive elements sequence. Your algorithm should run in \$O(n)\$ complexity. ...
1vote
1answer
138views
Daily Temperatures
The task is taken from leetcode Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer ...